#ifndef _SK_FILE_H_
#define  _SK_FILE_H_
#ifdef WIN32_PC
#include <Windows.h>
#endif	

#include "sk_common.h"
#include "sk_types.h"

struct SK_FILE;
typedef struct SK_FILE SK_FILE;

typedef enum
{
	EOPEN_FOR_READ,
	EOPEN_FOR_WRITE
}SK_FILE_OPENMODE; 

typedef enum
{
	ESEEK_BEGIN  ,
	ESEEK_CURRENT,
	ESEEK_END      
}SK_FILE_SEEKPOS;       

//Creates a new file for use
//Opens a new existing file for use
SK_FILE * SK_FILE_open(const SK_WCHAR * pszfileName,SK_FILE_OPENMODE mode);

//Closes a file which has been opened for use,and free pFile
void SK_FILE_close(SK_FILE *pFile);

//Sets the position to a desired point in the file,if ok return 0 else non-zero
SK_INT32 SK_FILE_seek(SK_FILE *pFile,SK_INT32 nOffset,SK_FILE_SEEKPOS nPos);

//return read bytes,-1 means failure
SK_INT32 SK_FILE_read(SK_FILE *o,void *buf, SK_UINT32 len);

//return written bytes,-1 means failure
SK_INT32 SK_FILE_write(SK_FILE *o, const void *buf, SK_UINT32 len);


//Gives the current position in the file,-1 means failure
SK_INT32 SK_FILE_tell(SK_FILE *pFile);
//get the file's length
SK_UINT32 SK_FILE_getLength(SK_FILE *pFile);

//Sets the position to the begining of the file
void SK_FILE_rewind(SK_FILE *pFile);


//////////////////////////////////////////////////////////////////////////
SK_BOOL SK_FILE_isExist(const SK_WCHAR * pszPath);
SK_BOOL SK_FILE_createDir(const SK_WCHAR * pszDirPath);
SK_BOOL SK_FILE_deleteDir(const SK_WCHAR * pszDirPath);
SK_BOOL SK_FILE_deleteFile(const SK_WCHAR * pszDirPath);
//return sub dirs' count.-1 means failure
SK_INT32 SK_FILE_listSubDirNames(const SK_WCHAR * pszDirPath,SK_WCHAR * subDirs[],SK_INT32 len);
//return sub files' count.-1 means failure
SK_INT32 SK_FILE_listSubFileNames(const SK_WCHAR * pszDirPath,SK_WCHAR * subFiles[],SK_INT32 len);
SK_BOOL SK_FILE_copyFile(const SK_WCHAR * des,const SK_WCHAR * src,SK_BOOL cover);

#endif
 